Skip to content

Batch 5: Event system — thread safety, IUpdateEventListener, Progress events#370

Merged
JusterZhu merged 1 commit into
masterfrom
batch-5-event-system
May 24, 2026
Merged

Batch 5: Event system — thread safety, IUpdateEventListener, Progress events#370
JusterZhu merged 1 commit into
masterfrom
batch-5-event-system

Conversation

@JusterZhu

Copy link
Copy Markdown
Collaborator

Summary

Event system improvements: thread-safe EventManager, batch listener registration, and real-time progress events.

Changes

EventManager — thread safety fix

  • Replaced Dictionary with ConcurrentDictionary
  • Each handler invoked individually so one handler exception doesn't prevent others
  • Lock-free AddOrUpdate for concurrent subscribe/unsubscribe

IUpdateEventListener — batch registration

  • New interface with all 7 event types
  • Register via bootstrap.AddEventListener\<T\>()
  • UpdateEventListenerBase class for optional overrides

ProgressEventArgs — real-time progress

  • New ProgressEventArgs wrapping DownloadProgress snapshot
  • AddListenerProgress(Action\<object, ProgressEventArgs\>) on bootstrap

DownloadProgressReporter bridge

  • Now dispatches Progress/Completed/Error/Failed events to EventManager
  • CreateEventBridge() factory method for IProgress

Build

  • dotnet build src/c#/GeneralUpdate.slnx — 0 errors

Closes #369

… events

- Rewrite EventManager with ConcurrentDictionary for thread safety
  Each handler invoked individually so one handler's exception
  doesn't prevent others from being called.
- Add IUpdateEventListener interface for batch registration
  of all 7 event types at once via AddEventListener<T>()
- Add UpdateEventListenerBase abstract class for optional overrides
- Add ProgressEventArgs and AddListenerProgress to Bootstrap
- Wire DownloadProgressReporter to fire Progress/Completed/Error
  events through EventManager automatically
- Fix test to match new OnProgress signature

Closes #369
Copilot AI review requested due to automatic review settings May 24, 2026 10:30
@JusterZhu JusterZhu merged commit 4bdb160 into master May 24, 2026
1 check failed
@JusterZhu JusterZhu deleted the batch-5-event-system branch May 24, 2026 10:31
@JusterZhu JusterZhu removed the request for review from Copilot May 24, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Batch 5: Event system — thread safety, IUpdateEventListener, AddListenerProgress

1 participant